API Documentation
String.h
1 // String.h
3 //
5 
6 namespace nkMemory
7 {
21  class String final
22  {
23  public :
24 
29  String () ;
36  String (const char* data) ;
43  String (unsigned long long size) ;
52  String (const char* data, unsigned long long size) ;
59  String (const StringView& view) ;
65  String (const String& other) ;
71  String (String&& other) noexcept ;
75  ~String () ;
76 
77  // Getters
81  char* getData () const ;
85  unsigned long long getSize () const ;
89  bool empty () const ;
93  char& front () ;
97  char& back () ;
98 
99  // Management
103  void clear () ;
110  void resize (unsigned long long size) ;
111 
112  // Utils
120 
121  // Operators
127  String& operator= (const char* data) ;
133  String& operator= (const StringView& other) ;
139  String& operator= (const String& other) ;
145  String& operator= (String&& other) noexcept ;
151  const char operator[] (unsigned long long index) const ;
157  char& operator[] (unsigned long long index) ;
163  void operator+= (char value) ;
169  void operator+= (const StringView& other) ;
176  String operator+ (char c) const ;
183  String operator+ (const char* other) const ;
190  String operator+ (const StringView& other) ;
197  bool operator== (const char* other) const ;
204  bool operator== (const StringView& other) const ;
211  bool operator!= (const char* other) const ;
218  bool operator!= (const StringView& other) const ;
219 
220  public :
221 
222  // Inlined constructors
229  String (const std::string& str) ;
236  String (const std::string_view& str) ;
237 
238  public :
239 
240  // Inlined operators
244  operator std::string () const ;
248  operator std::string_view () const ;
252  operator nkLog::String () const ;
256  operator nkLog::StringView () const ;
257 
264  StringView& operator= (const std::string& data) ;
271  StringView& operator= (const std::string_view& data) ;
272  } ;
273 
281  inline bool operator== (const char* c, const nkMemory::String& str) ;
282 
290  inline nkMemory::String operator+ (char c, const nkMemory::String& str) ;
298  inline nkMemory::String operator+ (const char* c, const nkMemory::String& str) ;
299 }
nkLog::StringView
Allows to exchange strings with external code.
Definition: StringView.h:18
nkMemory::String::String
String(const char *data)
nkMemory::String::String
String(const std::string_view &str)
nkMemory::String::operator!=
bool operator!=(const char *other) const
nkMemory::String::back
char & back()
nkMemory::String::front
char & front()
nkMemory::String::String
String(const std::string &str)
nkMemory::String::String
String(const String &other)
nkMemory::String::String
String(const StringView &view)
nkMemory::String::split
BufferCast< StringView > split(StringView separator)
nkMemory::operator+
nkMemory::String operator+(char c, const nkMemory::String &str)
nkMemory::String::empty
bool empty() const
nkMemory::String::operator[]
const char operator[](unsigned long long index) const
nkMemory::String::operator+
String operator+(char c) const
nkMemory::operator==
bool operator==(const char *c, const nkMemory::String &str)
nkMemory::String
Class holding information about a string, with ownership over the data.
Definition: String.h:22
nkMemory::String::~String
~String()
nkMemory::StringView
Class holding information about a string, with no ownership over the data.
Definition: StringView.h:22
nkMemory::BufferCast
Holds a Buffer and make it easy to cast the binary data.
Definition: BufferCast.h:18
nkMemory::String::String
String(unsigned long long size)
nkMemory::String::clear
void clear()
nkMemory::String::operator+=
void operator+=(char value)
nkMemory::String::String
String(const char *data, unsigned long long size)
nkMemory::String::operator==
bool operator==(const char *other) const
nkMemory::String::getData
char * getData() const
nkMemory::String::resize
void resize(unsigned long long size)
nkMemory::String::String
String()
nkMemory::String::getSize
unsigned long long getSize() const
nkMemory::String::operator=
String & operator=(const char *data)
nkMemory::String::String
String(String &&other) noexcept
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7